from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.support.select import Select
from time import  sleep
# 创建浏览器驱动对象
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
# 加载web页面
uil=r"E:\PyCharm 2021\pythonProject\UI自动\注册实例.html";
driver.get(uil)

# 案例：打开‘注册实例.html’页面，完成以下操作
# 1). 填写主页面的注册信息
driver.find_element_by_css_selector("#user").send_keys("admin")
driver.find_element_by_css_selector("#password").send_keys("123456")
driver.find_element_by_css_selector("#tel").send_keys("13512345678")
driver.find_element_by_css_selector("#email").send_keys("123@QQ.com")
# 2). 填写注册页面A中的注册信息
# 切换到注册A,点击注册A链接
driver.find_element_by_partial_link_text("A网页").click()



sleep(2)
# driver.find_element_by_css_selector("#ZCA").click()
driver.find_element_by_css_selector("#userA").send_keys("admin2")
driver.find_element_by_css_selector("#passwordA").send_keys("123456")
driver.find_element_by_css_selector("#telA").send_keys("13522345678")
driver.find_element_by_css_selector("#emailA").send_keys("123@qq.com")


sleep(3)
driver.quit()